 |
|
 |
Subject: winhttp substitute |
 |
 |
 |
Product Area: Domino Server |
 |
Technical Area: Administration |
 |
Platform: Linux server |
 |
Release: 8.5.3 |
 |
Reproducible: Always |
 |
 |
 |
 |
I just moved a database from a win to a Linux server, and an agent broke. Turns out, there's a windows only call in it.
Can anyone suggest a winhttp alternative for Linux, in the agent below? (I found something here http://www.poweroftheschwartz.com/web/blog/poweroftheschwartz.nsf/d6plinks/RSCZ-69GRRD that suggested Java instead, but that's a non-starter option as I don't know it and it's not in the life stress management plans for the next year or so.)
____________________________________
Function getXML(theURL As String) As String
' Use WinHTTP COM object to retrieve an XML page
Dim http As Variant
Dim temp As Variant
Dim xml As String
Dim xmlString As String
Dim i As Double
Dim statusNum As Double
Dim statusText As String
Dim errmsg As String
' use error trapping to account for two possible versions of WinHTTP that might be installed
On Error GoTo WinHTTP51_Error
Set http = CreateObject("WinHTTP.WinHTTPRequest.5.1")
GoTo Continue_WinHTTP
WinHTTP51_Error:
' failed creating WinHTTP 5.1 object, so try WinHTTP 5.0
Resume Try_WinHTTP50
Try_WinHTTP50:
On Error GoTo WinHTTP5_Error
Set http = CreateObject("WinHTTP.WinHTTPRequest.5")
On Error GoTo 0
Continue_WinHTTP:
On Error GoTo HTTP_Error
' Make an HTTP request to get the XML from the remote server
temp = http.Open("GET", theURL, False)
Call http.Send()
statusNum = http.status
statusText = http.statusText
xml = http.responseText
xmlString = CStr(xml)
On Error GoTo 0
Dim c1 As Long
Dim c2 As Long
Dim c3 As Long
' massage the XML to make sure that DOM parser won't barf on it
c1 = InStr(xmlString,"<!DOCTYPE")
If c1 > 0 Then
c2 = InStr(xmlString,"<!ENTITY")
If c2 > 0 Then
c3 = InStr(c2,xmlString,">")
c2 = InStr(c3+1,xmlString,">")
Else
c2 = InStr(c1,xmlString,">")
End If
For i = c1 To c2
Mid(xmlString,i,1) = " "
Next
End If
getXML = xmlString
Exit Function
HTTP_Error:
errmsg = "HTTP Error: " + CStr(Err()) + " " + Error(Err()) + " URL: " + theURL
Print errmsg
getXML = ""
Resume Bail
WinHTTP5_Error:
' had a problem with WinHTTP COM object - assume no access
errmsg = "WinHTTP Error: " + CStr(Err()) + " " + Error(Err()) + " URL: " + theURL
Print errmsg
getXML = ""
Resume bail
Bail:
Exit Function
End Function
 
Feedback number WEBB9HR8FQ created by ~Zach Quetponesononi on 04/01/2014

Status: Open
Comments:

winhttp substitute (~Zach Quetpones... 1.Apr.14)
. . LS2J (~Ned Nimfanakon... 1.Apr.14)
. . . . thanks (~Zach Quetpones... 6.Sep.14) |
|  |
|